// app.js
import ddt from './api/axios.js'
App({
  onLaunch(options) {
    //获得小程序码参数
    if (options.query.shopid){
      var shopid = options.query.shopid
      ddt("get", "/api/products/shopinfo?shopid=" + shopid).then(res => {
          wx.navigateTo({
            url: `/pages/orderfood/index?id=${shopid}&title=${res.data.data.shopname}`,
          })
      })
      // let str = decodeURIComponent(options.query.scene)
      // let arr = str.split('&')
      // if (arr[1]) { wx.setStorageSync('shopid', arr[1]) }
    }
    // 展示本地存储能力
    const logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)
 
    // 登录
   
    
  },
  //判断登陆过期
  logintype(){
    return new Promise((res,err)=>{
      wx.checkSession({
        success () {
          res(1)
        },
        fail () {
          err(2)
        }
      })
    })
   

  },
  globalData: {
    userInfo: null
  }
})
